home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / dev / basic / NIB1_00.lha / NewIconsBlitz / NIBExamples / ASCII / NIB_ExampleNIB.ASC next >
Text File  |  1999-04-28  |  2KB  |  111 lines

  1. ;
  2. ; Example of NewIcon image viewing ONLY! V1.00 (27/04/1999)
  3. ; (C) Robert Hutchinson 1999!
  4. ; Satanic Dreams Software 1999! [Loki^SD]
  5. ;
  6. ; Feel free to use this example any way you like ;)
  7. ;
  8. ; Please email me with any bug reports or changes please:
  9. ;
  10. ;   loki@sdsoft.freeserve.co.uk
  11. ;
  12. ; This can be used as an example of forcing the use of NewIcon
  13. ; images even when there is both data within the icon object.
  14. ;
  15. ; Requirements:
  16. ;
  17. ;   o NewIconsBlitz installed correctly (see docs)
  18. ;   o The NIB_Single_Include.BB2 include (provided)
  19. ;   o newicon.library (V4 preferably!)
  20. ;
  21.  
  22. WbToScreen 0
  23. WBenchToFront_
  24.  
  25.   XINCLUDE "/NIBIncludes/NIB_Include.BB2"
  26.  
  27.   ;--- Check our libraries
  28.   ;
  29.   If NIBCheckLibs{}=False
  30.     NPrint "Incorrect or non-present newicon.library/icon.library!"
  31.     End
  32.   EndIf
  33.  
  34.   ;--- Load files
  35.   ;
  36.   If NIBOpenIcon{0,"YAM:YAM"}       = False Then badicon=1
  37.   If NIBOpenIcon{1,"YAM:YAM.Guide"} = False Then badicon=1
  38.   If badicon=1
  39.     NPrint "Cant load file(s)!"
  40.     End
  41.  
  42.   EndIf
  43.  
  44.   ;--- Check the loaded data..
  45.   ;
  46.   imgs0.b=NIBCheckStruct{0}
  47.   imgs1.b=NIBCheckStruct{1}
  48.   If imgs0=0 OR imgs1=0
  49.     NIBFreeIcon{0}
  50.     NIBFreeIcon{1}
  51.     NPrint "No NewIcon data!"
  52.     End
  53.   EndIf
  54.  
  55.   ;--- Remap the chunky data to the images...
  56.   ;
  57.   NIBRemapChunkyData{0,#NIB_BOTH,0}
  58.   NIBRemapChunkyData{1,#NIB_BOTH,0}
  59.  
  60.   ;--- Find the largest height...
  61.   ;
  62.   DefHeight1.w=NIBFindHeight{0}
  63.   DefHeight2.w=NIBFindHeight{1}
  64.   If DefHeight1>DefHeight2
  65.     NewDef=DefHeight1
  66.   Else
  67.     NewDef=DefHeight2
  68.   EndIf
  69.  
  70.   ;--- Find the widths....
  71.   ;
  72.   DefWidth1.w=NIBFindWidth{0}
  73.   DefWidth2.w=NIBFindWidth{1}
  74.  
  75.   ;--- Our window....
  76.   ;
  77.   Window 0,50,50,((DefWidth1+DefWidth2)+13),(NewDef*2)+13,$1000,"",0,1
  78.   DefaultOutput
  79.  
  80.   ;--- Draw our images...
  81.   ;    By this point we KNOW we have the data to draw, so no error
  82.   ;    check required.
  83.   ;
  84.   succ.b=NIBDrawImage{0,#NIB_NORMAL  ,0,5,5}
  85.   succ.b=NIBDrawImage{0,#NIB_SELECTED,0,5,NewDef+8}
  86.   succ.b=NIBDrawImage{1,#NIB_NORMAL  ,0,DefWidth1+8,5}
  87.   succ.b=NIBDrawImage{1,#NIB_SELECTED,0,DefWidth1+8,NewDef+8}
  88.  
  89.   ;--- Wait for the mouse button hit
  90.   ;
  91.   MouseWait
  92.  
  93.   ;--- Free the images...
  94.   ;
  95.   NIBFreeImages{0,#NIB_BOTH,0}
  96.   NIBFreeImages{1,#NIB_BOTH,0}
  97.  
  98.   ;--- Free the icons...
  99.   ;
  100.   NIBFreeIcon{0}
  101.   NIBFreeIcon{1}
  102.  
  103.   ;--- Free the window..
  104.   ;
  105.   CloseWindow 0
  106.  
  107. End
  108.  
  109.  
  110.  
  111.